package com.gdk.service.impl;

import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.gdk.dao.PromotionDao;
import com.gdk.service.PromotionService;




/**
 *  促销活动业务处理
 * */
@Service("PromotionService")
public class PromotionServiceImpl implements PromotionService {
	@Autowired
    private PromotionDao promotionDao;
	/**
	 * 查看所有促销活动
	 * */
	@Override
	public List<Map<String, Object>> doFindAllPromotion() {
		return promotionDao.findAllPromotion();
	}
	/**
	 * 新增促销活动
	 * */
	@Override
	public int doAddPromotion(Map<String, Object> map) {
		return promotionDao.addPromotion(map);
	}
	/**
	 * 更改活动状态
	 * */
	@Override
	public int doUpdatePromotionStatus(Map<String, Object> map) {
		return promotionDao.updatePromotionStatus(map);
	}
	/**
	 * 查询活动详情
	 * */
	@Override
	public Map<String, Object> doFindPromotionDetails(Map<String, Object> map) {
		return promotionDao.findPromotionDetails(map);
	}
	/**
	 * 修改活动详情
	 * */
	@Override
	public int doUpdatePromotionDetails(Map<String, Object> map) {
		return promotionDao.updatePromotionDetails(map);
	}
	/**
	 * 活动绑定抵扣券
	 * */
	@Override
	public int doBindPromotionAndSmallTicket(Map<String, Object> map) {
		return promotionDao.bindPromotionAndSmallTicket(map);
	}
	/**
	 * 查询出已绑定的抵扣券
	 * */
	@Override
	public List<Map<String, Object>> doFindBindPromotionAndSmallTicket(Map<String, Object> map) {
		return promotionDao.findBindPromotionAndSmallTicket(map);
	}
	/**
	 * 修改活动前查出是否已有用户下单
	 * */
	@Override
	public List<Map<String, Object>> doFindOrderByTid(Map<String, Object> map) {
		return promotionDao.findOrderByTid(map);
	}
	/**
	 * 清空已绑定的活动
	 * */
	@Override
	public int doDelPromotionAndTicket(Map<String, Object> map) {
		return promotionDao.delPromotionAndTicket(map);
	}
	@Override
	public List<Map<String, Object>> selectAllTicket(Map<String, Object> map) {
		return promotionDao.selectAllTicket(map);
	}
	@Override
	public List<Map<String, Object>> findAllPromotionByFlag() {
		return promotionDao.findAllPromotionByFlag();
	}
	
	@Override
	public List<Map<String, Object>> findAllCouponByStatus() {
		return promotionDao.findAllCouponByStatus();
	}
	@Override
	public int addPromotionTicketAndCouponAndCard(Map<String,Object> map) {
		return promotionDao.addPromotionTicketAndCouponAndCard(map);
	}
	@Override
	public List<Map<String, Object>> findTicketBind(Map<String, Object> map) {
		return promotionDao.findTicketBind(map);
	}
	
	@Override
	public int delPromotionTicketAndType(Map<String, Object> map) {
		return promotionDao.delPromotionTicketAndType(map);
	}
	@Override
	public Map<String, Object> findCouponDetails(Map<String, Object> map) {
		return promotionDao.findCouponDetails(map);
	}
	
	@Override
	public List<Map<String, Object>> findAllPromotionByFlagAndStatus() {
		return promotionDao.findAllPromotionByFlagAndStatus();
	}
	@Override
	public List<Map<String, Object>> selectApplyUserManager(Map<String, Object> map) {
		return promotionDao.selectApplyUserManager(map);
	}
}
